package Cursus.Listeners;

import javax.swing.*;
import java.awt.*;

public class Swing_frame02 extends JFrame {
    private DefaultListModel dlm = new DefaultListModel();
    private JList list = new JList(dlm);

    public Swing_frame02() {
        Container c = this.getContentPane();
        c.add(new JLabel("toegevoegde elementen:"));
        c.add(list);
        c.setLayout(new FlowLayout());
        setLocation(100,100);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        new Swing_frame03(this);
        new Swing_frame03(this);
        new Swing_frame03(this);
        pack();
        setVisible(true);
    }

    public void voegtoeAanLijst(String s) {
        dlm.addElement(s);
        
    }

    public static void main(String args[]) {
        new Swing_frame02();
    }

}
